﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MetroCashLib.DataInfo;

namespace MetroCashLib.DataBussiness
{
    public class BAccountType
    {
        public static List<AccountType> getAllowedAccountTypes(string profileName, Account parrent)
        {
            try
            {
                using (var db = new SQLite.SQLiteConnection(Path.Combine(Windows.Storage.ApplicationData.Current.RoamingFolder.Path, Path.Combine(SettingStrings.PROFILE_FOLDER_NAME, profileName))))
                {
                    return db.Query<AccountType>("select * from AccountType where Id=" + parrent.AccountTypeId + " OR ParentId=" + parrent.AccountTypeId).ToList<AccountType>();
                }
            }
            catch(Exception ex)
            {
                return new List<AccountType>();
            }
        }
    }
}
